<template>
  <header class="navbar">
    <div class="navbar-container">
      <div class="navbar-left">
        <nuxt-link to="/" class="logo">
          <div class="logo-icon">X</div>
          <span class="logo-text">GetBioJob</span>
        </nuxt-link>
      </div>
      <nav class="navbar-center">
        <nuxt-link to="/jobs" class="nav-link">Jobs</nuxt-link>
        <nuxt-link to="/resume-templates" class="nav-link">Resume Builder</nuxt-link>
        <nuxt-link to="/for-employer" class="nav-link">For Employer</nuxt-link>
        <nuxt-link to="/pricing" class="nav-link">Pricing</nuxt-link>
      </nav>
      <div class="navbar-right">
        <template v-if="isLoggedIn">
          <nuxt-link to="/my-account" class="nav-link account-link">My Account</nuxt-link>
          <el-button type="text" @click="handleSignOut" class="sign-in-btn">Sign Out</el-button>
        </template>
        <template v-else>
          <el-button type="text" @click="$router.push('/sign-in')" class="sign-in-btn">Sign In</el-button>
          <el-button type="primary" @click="$router.push('/sign-up')" class="sign-up-btn">Sign Up</el-button>
        </template>
      </div>
    </div>
  </header>
</template>

<script>
export default {
  name: 'GetBioJobNavbar',
  data() {
    return {
      isLoggedIn: false
    }
  },
  mounted() {
    // Check if user is logged in (you can implement your own auth logic)
    this.checkAuth()
  },
  methods: {
    checkAuth() {
      // Check authentication status (implement your own logic)
      // For now, using localStorage as an example
      const token = localStorage.getItem('auth_token')
      this.isLoggedIn = !!token
    },
    handleSignOut() {
      localStorage.removeItem('auth_token')
      this.isLoggedIn = false
      this.$router.push('/')
      this.$message.success('Signed out successfully')
    }
  }
}
</script>

<style scoped>
.navbar {
  background-color: #ffffff;
  border-bottom: 1px solid #e5e5e5;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-left {
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #000;
  font-weight: bold;
  font-size: 20px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background-color: #000;
  color: #fff;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  font-weight: bold;
}

.logo-text {
  color: #000;
}

.navbar-center {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-link {
  color: #333;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s;
}

.nav-link:hover {
  color: #000;
}

.nav-link.nuxt-link-active {
  color: #000;
  font-weight: 500;
}

.account-link {
  margin-right: 16px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sign-in-btn {
  color: #333;
  padding: 8px 16px;
}

.sign-up-btn {
  background-color: #000;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 4px;
}

.sign-up-btn:hover {
  background-color: #333;
}

@media screen and (max-width: 768px) {
  .navbar-center {
    display: none;
  }
  
  .navbar {
    padding: 0 16px;
  }
}
</style>

